using System;
using System.Collections.Generic;

public class Node
{
   private Dictionary<String, Node> edges;
 
   public bool Visited { get; set;}
   public string Name { get; set;}
   
   public Node(string name) 
   {
      Name = name;
      Visited = false;
      edges = new Dictionary<String, Node>();
   }


   public void AddEdge(Node target) 
   {
      if (edges.ContainsKey(target.Name))
      {
          Console.WriteLine("ERROR:  Node " + Name + " already contains edge to " + target.Name);
          return;
      }      

      edges.Add(target.Name, target);
   } 
   
   public ICollection<String> GetEdges() 
   {
      return edges.Keys;
   }


   public Node TravelTo(string nodeName)
   {
      if (edges.ContainsKey(nodeName))
         return edges[nodeName];
      else
         return null;
   }
   
   //not really needed anymore
   /*
   public override bool Equals(Object obj) 
   {
      Node other = obj as Node;
      if (other == null)
         return false;

      return other.name.Equals(name);
   }
   public override int GetHashCode() 
   {
      return name.GetHashCode();
   }
   */
}
